local s15__luoshen = fk.CreateSkill {
  name = "s15__luoshen",
}

Fk:loadTranslationTable {
  ["s15__luoshen"] = "洛神",
  [":s15__luoshen"] = "准备阶段开始时，你可以进行判定：若结果为黑色，判定牌生效后你获得之，然后你可以重复此流程。若结果为红色，判定牌生效后你获得之，然后终止此流程。",
}

s15__luoshen:addEffect(fk.EventPhaseStart, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(s15__luoshen.name) and player.phase == Player.Start
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    while true do
      local judge = {
        who = player,
        reason = s15__luoshen.name,
        pattern = ".|.|spade,club",
      }
      room:judge(judge)

      -- 无论什么颜色都获得判定牌
      player.room:obtainCard(player, judge.card, true, fk.ReasonJustMove, player, s15__luoshen.name)

      -- 如果是红色，终止流程
      if judge.card.color == Card.Red or player.dead then
        break
      end

      -- 如果是黑色，直接重复判定
      -- 无需询问，继续循环
    end
  end,
})

return s15__luoshen
